package com.zxcl.pool;

import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

import java.util.concurrent.*;

@Component
public class EsImportThreadPool {
    public static ThreadPoolExecutor esPool = new ThreadPoolExecutor(
            13, 20, 1L, TimeUnit.MINUTES,
            new LinkedBlockingDeque<>() //有无长度限制的队列 ,如果你不给,发现Integer.MAX_VALUE的容量  阻塞队列
            , new ThreadFactory() {
        @Override
        public Thread newThread(@NotNull Runnable r) {
            return new Thread(r);   //有任务进来这个方法才会被调用,也就是说默认初始线程数量是0
        }
    },
            new RejectedExecutionHandler() {
                @Override
                public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {

                }
            }
    );

}
